<?php

namespace App\Admin\Forms\Settings;

use Encore\Admin\Widgets\Form;
use Illuminate\Http\Request;
use function app\Helpers\sys;

class Manager extends BaseTabForm
{
    /**
     * The form title.
     *
     * @var string
     */
    public $title = '后台设置';

    /**
     * Handle the form request.
     *
     * @param Request $request
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function handle(Request $request)
    {
        parent::handle($request);

        admin_success('Processed successfully.');

        return back();
    }

    /**
     * Build a form here.
     */
    public function form()
    {
        //        $this->image('background_img', '登录页背景图')->rules('required');
        //        $this->text('background_img', '登录页背景图')->rules('required');
        //        $this->text('logo', 'logo')->rules('required');
        $this->text('manager_title', '登录页标题')->rules('required');
        $this->text('company_name', '公司名')->rules('required');
        $this->text('company_contact_number', '公司联系方式')->rules('required');
        $this->text('put_record', '备案号')->rules('required');
    }

    /**
     * The data of the form.
     *
     * @return array $data
     */
    public function data()
    {
        return [
            //            'background_img'         => sys('background_img'),
            'manager_title'          => sys('manager_title'),
            //            'logo'                   => sys('logo'),
            'company_name'           => sys('company_name'),
            'company_contact_number' => sys('company_contact_number'),
            'put_record'             => sys('put_record'),
        ];
    }
}
